<?php
$url = trim($_GET['url']);
$xmltext = file_get_contents($url);
$id = (int)$_GET['id'];
try {
    $xml = new SimpleXMLElement($xmltext);
} catch (Exception $e) {
    die("document.write('Unable to parse xml');");
}
$iframeurl = "http://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']) . "/doc.php?id=$id&amp;url=".urlencode($url);

if (isset($xml->ModulePrefs['height'])) {
	$height = $xml->ModulePrefs['height'];
} else {
	$height = 200;
}
?>
document.write("<div class=\"asdfasdfmodule\" style=\"width: 300px; height:<?=
$height+20 ?>px;\">");
document.write("<h2><?= $xml->ModulePrefs['title'] ?></h2>");
document.write("<iframe src=\"<?= $iframeurl ?>\" width=\"300\" height=\"<?=
$height ?>\" name=\"frame<?= $id ?>\"></iframe>");
document.write("</div>");